package com.lu;

import java.util.Scanner;

/**
 * @author lufeng
 * @date 2021/9/5 15:27
 */
public class test6_6 {
    public static void main(String[] args) {

        int[] arr = new int[6];
        Scanner sc = new Scanner(System.in);
        for (int i = 0; i < arr.length; i++) {
            System.out.println("请输入第" + (i + 1) + "个数");
            int score = sc.nextInt();
            //判断数据是否是正确的
            if (score >= 0 && score <= 100) {
                arr[i] = score;
            } else {
                System.out.println("您输入的数据有误，请输入0-100之间的数值");
                i--;
            }
        }
        int sum = 0;
        for (int i = 0; i < arr.length; i++) {
            sum += arr[i];
        }
        int max = arr[0];
        for (int i = 0; i < arr.length; i++) {
            if (arr[i] > max) {
                max = arr[i];
            }
        }
        int min = arr[0];
        for (int i = 0; i < arr.length; i++) {
            if (arr[i] < min) {
                min = arr[i];

            }
        }
        double a = ((sum - min - max) * 1.0) / arr.length - 1;
        System.out.println("最大值为：" + max);
        System.out.println("最小值为：" + min);
        System.out.println("和为：" + sum);
        System.out.println("平均值为：" + a);
    }

}
